/*
 *    Copyright (c) 2018-2025, proj All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the proj developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: proj
 */

package com.ykht.proj.activity.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ykht.proj.activity.entity.VCard;
import com.ykht.proj.activity.vo.CardShopVo;
import com.ykht.proj.activity.vo.VCardVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 卡表
 *
 * @author csg
 * @date 2021-05-21 14:21:47
 */
@Mapper
public interface VCardMapper extends BaseMapper<VCard> {
	/**
	 * 获取创建活动的 卡列表分页查询
	 *
	 * @param page    分页
	 * @param vCardVo 条件
	 * @return
	 */
	IPage<VCardVo> getByActivityAndCardPage(Page page, @Param("req") VCardVo vCardVo);

	/**
	 *
	 * @param salesVolume
	 * @param activitySaleVolume
	 * @param activationVolume
	 * @param frozenVolume
	 * @param id
	 * @return
	 */
	Boolean updateSalesVolume(@Param("saleVolume") Integer salesVolume,@Param("activitySaleVolume") Integer activitySaleVolume
			,@Param("activationVolume") Integer activationVolume,@Param("frozenVolume") Integer frozenVolume,@Param("id")Long id);

	/**
	 * 获取企业购买卡 列表分页查询
	 *
	 * @param page    分页
	 * @param vCardVo 条件
	 * @return
	 */
    IPage<VCardVo> getEntBuyCardPage(Page page, @Param("req") VCardVo vCardVo);

	/**
	 * 批量修改 卡库存
	 * @param cardList
	 */
    void updateBatch(@Param("req") List<VCard> cardList);

    List<CardShopVo> shopByCardIds(@Param("ids") List<Long> cardIds);

	/**
	 * 企业绑定卡  给卡添加激活数量+1
	 * @param id
	 */
	void updateActivationVolume(@Param("id") Long id);

	/**
	 * 添加库存（加减库存）
	 * @param vCardVo
	 */
	void addStockNumber(@Param("vCardVo") VCardVo vCardVo);

}
